package cn.kpi.service.sys.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.kpi.dao.sys.RoleDao;
import cn.kpi.entity.sys.RoleEntity;
import cn.kpi.service.sys.IRoleService;

@Service
public class RoleServiceImpl implements IRoleService {
	@Autowired
	private RoleDao roleDao;

	public List<RoleEntity> GetRoleList(String where) {
		try {
			return roleDao.GetRoleList(where);
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}
	public int GetRoleListCount(String where)throws Exception{
		try {
			return roleDao.GetRoleListCount(where);
		} catch (Exception ex) {
			ex.printStackTrace();
			return -1;
		}
	}
	
	public int InsertEntity(RoleEntity entity)throws Exception{
		try {
			return roleDao.InsertEntity(entity);
		} catch (Exception ex) {
			ex.printStackTrace();
			return -1;
		}
	}
	public int UpdateEntity(RoleEntity entity)throws Exception{
		try {
			return roleDao.UpdateEntity(entity);
		} catch (Exception ex) {
			ex.printStackTrace();
			return -1;
		}
	}
	public int DeleteEntity(Long roleid)throws Exception{
		try {
			return roleDao.DeleteEntity(roleid);
		} catch (Exception ex) {
			ex.printStackTrace();
			return -1;
		}
	}

    @Override
    public RoleEntity GetRoleByName(String RoleName) throws Exception {
		try {
			return roleDao.GetRoleByName(RoleName);
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
    }

    public List<RoleEntity> GetRoleListLimit(String where,String order,int beginrow,int endrow) throws Exception{
		try {
			return roleDao.GetRoleListLimit(where,order,beginrow,endrow);
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}
}
